﻿# Education events for children

namespace = childhood_education_ua

# Pedagogy effect
childhood_education_ua.9004 = {
	hidden = yes

	trigger = {
		age >= 5
		OR = {
			any_relation = {
				type = guardian
				has_perk = pedagogy_perk
			}
			court_owner.court_position:court_tutor_court_position ?= {
				has_perk = pedagogy_perk
			}
		}
	}

	immediate = {
		save_scope_as = child
		if = {
			limit = {
				any_relation = {
					type = guardian
					has_perk = pedagogy_perk
				}
			}
			random_relation = {
				type = guardian
				limit = {
					has_perk = pedagogy_perk
				}
				save_scope_as = guardian
			}
		}
		else_if = {
			limit = {
				court_owner.court_position:court_tutor_court_position ?= {
					has_perk = pedagogy_perk
				}
			}
			court_owner.court_position:court_tutor_court_position ?= {
				save_scope_as = guardian
			}
		}
		if = {
			limit = {
				age >= 7
				NOR = {
					has_relation_friend = scope:guardian
					has_relation_best_friend = scope:guardian
					has_relation_rival = scope:guardian
					has_relation_nemesis = scope:guardian
				}
			}
			random = {
				chance = 20
				compare_modifier = {
					trigger = {
						age >= 9
					}
					value = age
					multiplier = 2
				}
				save_scope_value_as = {
					name = set_friendship
					value = yes
				}
			}
		}
		random_list = {
			80 = { }
			4 = { # Gain Diplomacy
				send_interface_toast = {
					title = childhood_education.9004.child_message
					left_icon = scope:guardian
					
					add_diplomacy_skill = 1
					if = {
						limit = {
							exists = scope:set_friendship
						}
						set_relation_friend = { reason = friend_pedagogy target = scope:guardian }
					}
				}
				scope:guardian = {
					send_interface_message = {
						type = event_diplomacy_good
						title = childhood_education.9004.guardian_message
						left_icon = scope:child

						show_as_tooltip = {
							scope:child = {
								add_diplomacy_skill = 1
							}
							if = {
								limit = {
									exists = scope:set_friendship
								}
								set_relation_friend = { reason = friend_pedagogy target = scope:child }
							}
						}
					}
				}
			}
			4 = { # Gain Martial
				send_interface_toast = {
					title = childhood_education.9004.child_message
					left_icon = scope:guardian

					add_martial_skill = 1
					if = {
						limit = {
							exists = scope:set_friendship
						}
						set_relation_friend = { reason = friend_pedagogy target = scope:guardian }
					}
				}
				scope:guardian = {
					send_interface_message = {
						type = event_martial_good
						title = childhood_education.9004.guardian_message
						left_icon = scope:child

						show_as_tooltip = {
							scope:child = {
								add_martial_skill = 1
							}
							if = {
								limit = {
									exists = scope:set_friendship
								}
								set_relation_friend = { reason = friend_pedagogy target = scope:child }
							}
						}
					}
				}
			}
			4 = { # Gain Learning
				send_interface_toast = {
					title = childhood_education.9004.child_message
					left_icon = scope:guardian

					add_learning_skill = 1
					if = {
						limit = {
							exists = scope:set_friendship
						}
						set_relation_friend = { reason = friend_pedagogy target = scope:guardian }
					}
				}
				scope:guardian = {
					send_interface_message = {
						type = event_learning_good
						title = childhood_education.9004.guardian_message
						left_icon = scope:child

						show_as_tooltip = {
							scope:child = {
								add_learning_skill = 1
							}
							if = {
								limit = {
									exists = scope:set_friendship
								}
								set_relation_friend = { reason = friend_pedagogy target = scope:child }
							}
						}
					}
				}
			}
			4 = { # Gain Intrigue
				send_interface_toast = {
					title = childhood_education.9004.child_message
					left_icon = scope:guardian

					add_intrigue_skill = 1
					if = {
						limit = {
							exists = scope:set_friendship
						}
						set_relation_friend = { reason = friend_pedagogy target = scope:guardian }
					}
				}
				scope:guardian = {
					send_interface_message = {
						type = event_intrigue_good
						title = childhood_education.9004.guardian_message
						left_icon = scope:child

						show_as_tooltip = {
							scope:child = {
								add_intrigue_skill = 1
							}
							if = {
								limit = {
									exists = scope:set_friendship
								}
								set_relation_friend = { reason = friend_pedagogy target = scope:child }
							}
						}
					}
				}
			}
			4 = { # Gain Stewardship
				send_interface_toast = {
					title = childhood_education.9004.child_message
					left_icon = scope:guardian

					add_stewardship_skill = 1
					if = {
						limit = {
							exists = scope:set_friendship
						}
						set_relation_friend = { reason = friend_pedagogy target = scope:guardian }
					}
				}
				scope:guardian = {
					send_interface_message = {
						type = event_stewardship_good
						title = childhood_education.9004.guardian_message
						left_icon = scope:child

						show_as_tooltip = {
							scope:child = {
								add_stewardship_skill = 1
							}
							if = {
								limit = {
									exists = scope:set_friendship
								}
								set_relation_friend = { reason = friend_pedagogy target = scope:child }
							}
						}
					}
				}
			}
			2 = { # Gain Prowess
				send_interface_toast = {
					title = childhood_education.9004.child_message
					left_icon = scope:guardian
					
					add_prowess_skill = 1
					if = {
						limit = {
							exists = scope:set_friendship
						}
						set_relation_friend = { reason = friend_pedagogy target = scope:guardian }
					}
				}
				scope:guardian = {
					send_interface_message = {
						type = event_prowess_good
						title = childhood_education.9004.guardian_message
						left_icon = scope:child

						show_as_tooltip = {
							scope:child = {
								add_prowess_skill = 1
							}
							if = {
								limit = {
									exists = scope:set_friendship
								}
								set_relation_friend = { reason = friend_pedagogy target = scope:child }
							}
						}
					}
				}
			}
		}
	}
}